//
//  LSPuerseDetailView.m
//  HappyStore
//
//  Created by 陈锋 on 16/8/15.
//  Copyright © 2016年 LLJ. All rights reserved.
//

#import "LSPuerseDetailView.h"

@interface LSPuerseDetailView ()
@property (weak, nonatomic) IBOutlet UILabel *payNo;
@property (weak, nonatomic) IBOutlet UILabel *typeTitle;
@property (weak, nonatomic) IBOutlet UILabel *timeTitle;
@property (weak, nonatomic) IBOutlet UILabel *tradeNo;
@property (weak, nonatomic) IBOutlet UILabel *payDetail;

@end

@implementation LSPuerseDetailView


- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"白色背景"] forBarMetrics:UIBarMetricsDefault];
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    self.title = @"详情";
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 190, 44)];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.font = [UIFont systemFontOfSize:19];
    titleLabel.text = @"详情";
    titleLabel.textColor = RGB(45, 45, 45);
    titleLabel.textAlignment = NSTextAlignmentCenter;
    self.navigationItem.titleView = titleLabel;
    
    //设置返回按钮
    UIBarButtonItem *leftItem = [UIBarButtonItem itemWithTarget:self action:@selector(leftBarButtonItemClick) image:@"返回" highImage:@"返回"];
    self.navigationItem.leftBarButtonItem = leftItem;
    
    if ([self.dict[@"payType"] integerValue] == 2) {
        
        self.payNo.text = [NSString stringWithFormat:@"-%.3f",[self.dict[@"payMoney"] floatValue]];
        self.payNo.textColor = [UIColor greenColor];
        
    }else{
        
        self.payNo.text = [NSString stringWithFormat:@"+%.3f",[self.dict[@"payMoney"] floatValue]];
        self.payNo.textColor = [UIColor redColor];
        
    }
    
    if ([self.dict[@"payWay"]integerValue] == 1) {
        
        self.typeTitle.text = @"余额";
        
    }else{
    
        self.typeTitle.text = @"支付宝";
    
    }
    
    self.timeTitle.text = self.dict[@"payTime"];
    self.tradeNo.text = self.dict[@"orderNo"];
    self.payDetail.text = self.dict[@"payReason"];
}
-(void)leftBarButtonItemClick{
    [self.navigationController popViewControllerAnimated:YES];
}

@end
